import {census} from '~/api/home'
import { ref,reactive } from 'vue';

export const navs = ref([
    '企业介绍',
    '企业资质',
    '合作案例'
])
export const activeId = ref(0)
export const tapNavs = (e)=>{
    activeId.value = e
}

export const loading = ref(true)
export const xzuser = ref(0)
export const allnum = ref(0)

export const activityEnrollInfos = ref([])
export const monthLoginDmos = ref([])
export const monthRegisterDmos = ref([])
export const newCardList = ref([])
export const companyQualification = ref('')
export const BIU = ref('')
export const BIUImage = ref([])
export const getList = (callBack)=>{
    loading.value = true
    census().then(res=>{
        if(res&&res.code == '0000'){
            // 新加三个基本信息
            BIUImage.value = res.data.result.thisCorporationlog
            BIU.value = res.data.result.thisCorporation?.naturalDescription
            companyQualification.value = res.data.result.thisCorporation?.orgDescription
            // activityEnrollInfos.value = res.data.result.activityEnrollInfos
            monthLoginDmos.value = res.data.result.monthLoginDmos.map(v=>{
                return v.num
            })
            monthRegisterDmos.value = res.data.result.monthRegisterDmos.map(v=>{
                return v.num
            })
            allnum.value = res.data.result.allnum
            xzuser.value = res.data.result.xzuser
            newCardList.value  =  res.data.result.activityEnrollInfos
            activityEnrollInfos.value = res.data.result.activityEnrollInfos.map(v=>{
                return [
                    v.name,
                    v.num,
                    v.createtime
                ]
            })
            config.data = activityEnrollInfos.value
        }


        if(callBack&&typeof callBack == 'function'){
            callBack(monthLoginDmos.value, monthRegisterDmos.value,res.data.result.zxmonth)
        }





        
    }).finally(()=>{
        loading.value = false
    })
}


export const config = reactive({
    header: ['活动名称', '报名人数', '发布时间'],
    data: [],
    columnWidth: [310,100,100],
    align: ['center'],
  })


  